﻿using FastMvc.Models;
using System;
using System.Collections.Generic;
using System.Text;

namespace FastMvc.Exceptions
{
    /// <summary>
    /// 由接口主动调用并且返回的api错误
    /// * 接口视为调用成功, 但是成功标志为false(code = 200, success = false)
    /// </summary>
    public class ApiException: Exception
    {
        public int Code { get; private set; }
        public List<ErrorMsg> Errors { get; private set; }

        public ApiException(string message, int code = -1, List<ErrorMsg> errors = null)
            : base(message)
        {
            this.Code = code;
            this.Errors = errors;
        }
    }
}
